<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserPassChatLmtTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_pass_chat_lmt', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
            $table->unsignedSmallInteger('lmt_msg_num')->default(0)->comment('通过消息条数');
            $table->char('device_id', 40)->default('')->comment('设备ID');
            $table->timestamps();
            $table->unsignedTinyInteger('flag')->default(1)->comment('状态');
            $table->index('user_id', 'user_id');
            $table->index('device_id', 'device_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_pass_chat_lmt');
    }
}
